﻿
using CSharpLibs.Annotations;

#pragma warning disable 0169

namespace System
{
	[Builtin]
	public struct Boolean : IUSignIntegralValue, IComparable, IComparable<Boolean>, IEquatable<Boolean>
	{
		[DummyPrimitiveField]
		private bool ff;

		public int CompareTo(object o)
		{ return this.CompareTo((Boolean)o); }

		public int CompareTo(Boolean b)
		{
			if(this == b)
				return 0;
			else if(!this & b)
				return -1;
			else
				return 1;
		}

		public override bool Equals(object o)
		{ return (o is Boolean) && this.Equals((Boolean)o); }

		public bool Equals(Boolean b)
		{ return this == b; }

		public override int GetHashCode()
		{ return this ? 1 : 0; }

		public static bool Parse(String sv)
		{ return PrimitiveHelper.ParseIntegral(sv) == 0; }

		public  override string ToString()
		{ return PrimitiveHelper.IntegralToString(this ? 1 : 0); }
	}
}

#pragma warning restore 0169

